package com.xmy.cultivate.mapper;

import com.xmy.cultivate.entity.TrackMarket;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 赛道-市场部 Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2024-06-15
 */
public interface TrackMarketMapper extends BaseMapper<TrackMarket> {

    /**
     * 获取所有子id
     * @param id
     * @return
     */
    @Select("select getTrackMarketChIdAll(${id})")
    public String getTrackMarketChIdAll(@Param("id") Long id);

    @Select("SELECT GROUP_CONCAT( DISTINCT id SEPARATOR ',' ) AS ids FROM track_market WHERE year_part = ${yearPart} AND quarter_num = ${quarterNum} AND classify = ${classify} AND track_type = 2 AND STATUS = 1 AND deleted = 0 AND pid = ${pId}")
    public String getIdByPid(@Param("pId") Long pId,@Param("yearPart") String yearPart,@Param("quarterNum") String quarterNum,@Param("classify") Integer classify);
}
